import sys

import django
import os

base_dir=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
#TODO:这里可能有问题
os.environ.setdefault("DJANGO_SETTINGS_MODULE",'djangoProject.settings')
django.setup()#模拟Django启动,从而操作数据库

from web import  models
def run():#启动数据库
    exists=models.PricePolicy.objects.filter(category=1,title='个人免费版').exists()
    if not exists:
        models.PricePolicy.objects.create(
            category=1,
            title='个人免费版',
            price=0,
            project_num=3,
            project_member=2,
            project_space=20,
            per_file_size=5
        )
if __name__ == '__main__':
    run()
